<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改考勤')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-attendance-edit" th:object="${workstudyAttendance}">
            <input name="attendanceId" th:field="*{attendanceId}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">学生：</label>
                <div class="col-sm-8">
                    <select name="userId" class="form-control m-b" required>
                        <option value="">请选择学生</option>
                        <option th:each="user:${students}" th:value="${user.userId}" th:text="${user.userName}+'('+${user.loginName}+')'" th:field="*{userId}" th:disabled="${user.status == '1'}" required></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">岗位：</label>
                <div class="col-sm-8">
                    <select name="postId" class="form-control m-b" required>
                        <option value="">请选择岗位</option>
                        <option th:each="post:${postList}" th:value="${post.postId}" th:text="${post.postName}" th:field="*{postId}" required></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">开始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="startTime" th:value="${#dates.format(workstudyAttendance.startTime, 'yyyy-MM-dd HH:mm')}" class="form-control" placeholder="yyyy-MM-dd HH:mm" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="endTime" th:value="${#dates.format(workstudyAttendance.endTime, 'yyyy-MM-dd HH:mm')}" class="form-control" placeholder="yyyy-MM-dd HH:mm" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>工作时长计算到小时</span>
                </div>
            </div>
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">工作时长：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="duration" th:field="*{duration}" placeholder="2小时30分输入格式是2.5" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
            <div class="form-group">    
                <label class="col-sm-3 control-label">结算工资：</label>
                <div class="col-sm-8">
                    <input name="price" th:field="*{price}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('workstudy_attendance_status')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">工作质量(%)：</label>
                <div class="col-sm-8">
                    <input name="quality" th:field="*{quality}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "workstudy/attendance";
        $("#form-attendance-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-attendance-edit').serialize());
            }
        }

        $("input[name='startTime']").datetimepicker();

        $("input[name='endTime']").datetimepicker();

        $("input[name='attendanceTime']").datetimepicker();

        $("input[name='settlementTime']").datetimepicker();
    </script>
</body>
</html>